package com.vanke.devops.api.controller.applications;

import com.vanke.core.bean.ApiBaseResponse;
import com.vanke.core.bean.PagingResponse;
import com.vanke.devops.api.base.AbstractController;
import com.vanke.devops.dal.model.Applications;
import com.vanke.devops.domain.domain.applications.IApplicationsService;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 应用表  前端控制器
 * </p>
 *
 * @author 陈景阳
 * @since 2018-03-12
 */
@RestController
@RequestMapping("/applications")
public class ApplicationsController extends AbstractController<IApplicationsService> {

    @GetMapping(value = "/page/{pageSize}/{pageNo}")
    public PagingResponse list(@ModelAttribute Applications param, @PathVariable("pageSize") Integer pageSize, @PathVariable("pageNo") Integer pageNo)  {
        return super.queryWithPage(param, pageSize, pageNo);
    }

    @GetMapping(value = "/{id}")
    public ApiBaseResponse get(@PathVariable("id") Integer id)  {
        return super.getDetail(id);
    }

    @PutMapping(value = "/{id}")
    public ApiBaseResponse update(@RequestBody Applications param, @PathVariable("id") Integer id)  {
        param.setId(id);
        return super.updateRecord(param);
    }

    @DeleteMapping(value = "/{id}")
    public ApiBaseResponse delete(@PathVariable("id") Integer id)  {
        return super.deleteRecord(id);
    }

    @PostMapping
    public ApiBaseResponse add(@RequestBody Applications param)  {
        return super.addRecord(param);
    }
}